const {
	Service
} = require("uni-cloud-router");
const {
	httpClientCode
} = require("config");
const db = uniCloud.database();
const {
	checkToken
} = require('common-uni-id');
module.exports = class EntitlementService extends(
	Service
) {

	async get(event) {
		let response = {
			code: httpClientCode.ERROR.value,
			msg: '查询数据失败',
			data: null
		};
		let type = event.data.type
		response.code = httpClientCode.SUCCESS.value;
		response.msg = '查询数据成功';
		if (type === 1) { //日报
			response.data = [{
				name: '智链1',
				sum: 500000
			}, {
				name: '智2',
				sum: 400000
			}, {
				name: '智3',
				sum: 300000
			}];
		} else if (type === 2) { //周报
			response.data = [{
				name: '智链1',
				sum: 3500000
			}, {
				name: '智2',
				sum: 2400000
			}, {
				name: '智3',
				sum: 2300000
			}];
		} else if (type === 3) { //月报
			response.data = [{
				name: '智链1',
				sum: 10500000
			}, {
				name: '智2',
				sum: 6400000
			}, {
				name: '智3',
				sum: 5300000
			}];
		}

		return response;
	}
};